package com.raja.servingStation;

import com.raja.servingStation.datasources.DataSourceConfig;
import com.raja.servingStation.datasources.RepairSql2oTemp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.sql2o.Sql2o;

@SpringBootApplication
@EnableScheduling
@EnableDiscoveryClient
public class Application   implements CommandLineRunner {

	@Autowired
	private RepairSql2oTemp repairSql2oTemp;
	@Autowired
	DataSourceConfig dataSourceConfig;


	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	@Override
	public void run(String... strings) throws Exception {
		repairSql2oTemp.setSql2o(new Sql2o(dataSourceConfig.dataSource()));
	}
}
